package com.pan.api.config.impl;

import com.pan.api.config.ConfigUnit;
import com.pan.api.utils.PanApiDocXmlUtil;
import com.pan.api.filter.ControllerFilter;
import com.pan.api.utils.PanReflectUtil;
import org.w3c.dom.Element;

final class FilterConfigUnit
        extends ConfigUnit<ControllerFilter>
        implements PanApiDocXmlUtil, PanReflectUtil
{

    public static final FilterConfigUnit INSTANCE = new FilterConfigUnit();

    @Override
    protected ControllerFilter createNewObjectInstance() {
        Element filterElement = findFirst("filter");
        String filterClassName = filterElement.getTextContent().strip();
        ControllerFilter controllerFilter = createNewInstance(filterClassName);
        return controllerFilter;
    }
}
